package com.yanqu.road.server.cmd.activity.stronghold.wild;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.pb.activity.StrongholdWarCrossProto;
import com.yanqu.road.pb.activity.StrongholdWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.strongholdwar.StrongholdActivityMgr;
import com.yanqu.road.server.manger.activity.strongholdwar.StrongholdWarMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

import java.util.List;

@Cmd(code = GameProtocol.S_STRONGHOLD_WAR_ITEM_DONATE_DATA,desc = "获取道具捐献详情")
public class GetStrongholdItemDonateDataCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ActivityInfo activityInfo = StrongholdActivityMgr.getOpenActivityInfo();
    /*    StrongholdWarProto.StrongholdItemDonateDataRespMsg.Builder msg = StrongholdWarProto.StrongholdItemDonateDataRespMsg.newBuilder();
        StrongholdWarProto.StrongholdItemDonateDataMsg.Builder dataMsg = StrongholdWarProto.StrongholdItemDonateDataMsg.newBuilder();*/
        String unionUid = player.getUserInfo().getUnionUid();
      /*  List<Integer> donateData = StrongholdWarMgr.getDonateItemProcess(activityInfo.getActivityId(), unionUid);
        for (int i = 0; i < donateData.size(); i++) {
            StrongholdWarProto.StrongholdItemDonateTempMsg.Builder tempMsg = StrongholdWarProto.StrongholdItemDonateTempMsg.newBuilder();
            tempMsg.setType(i);
            tempMsg.setValue(donateData.get(i));
            dataMsg.addDonateMsg(tempMsg);
        }
        msg.setData(dataMsg);
        player.sendChannelPacket(ClientProtocol.U_STRONGHOLD_WAR_ITEM_DONATE_DATA, msg);*/
        StrongholdWarCrossProto.StrongholdCrossDonateItemProcessReqMsg.Builder reqMsg = StrongholdWarCrossProto.StrongholdCrossDonateItemProcessReqMsg.newBuilder();
        reqMsg.setActivityId(activityInfo.getActivityId());
        reqMsg.setUnionId(unionUid);
        player.sendUnionActivityGroupPacket(CrossProtocol.C_CROSS_STRONGHOLD_DONATE_ITEM_PROCESS,reqMsg, reqMsg.getActivityId());
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
